package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.LogMapper;
import com.itheima.pojo.Log;
import com.itheima.pojo.LogQueryParam;
import com.itheima.pojo.PageResult;
import com.itheima.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class LogServiceImpl implements LogService {


    @Autowired
    private LogMapper logMapper;

    @Override
    public PageResult queryLogList(LogQueryParam l) {
        PageHelper.startPage(l.getPage(), l.getPageSize());
        List<Log> logList = logMapper.list(l);
        Page<Log> p = (Page<Log>) logList;
        return new PageResult(p.getTotal(),p.getResult());
    }
}
